#include "stone.h"

stone::stone(QWidget *parent) :
    QWidget(parent)
{

}

stone::~stone()
{
}
void stone::startChess(const int n){
    dead=false;
    num=n;
    if (n<16)
        white=true;
    else
        white=false;
    switch(n)
    {
        case 0:
               x=0; y=7; chessType=rook;
               break;
        case 1:
               x=1; y=7; chessType=knight;
               break;
        case 2:
               x=2; y=7; chessType=bishop;
               break;
        case 3:
               x=3; y=7; chessType=queen;
               break;
        case 4:
               x=4; y=7; chessType=king;
               break;
        case 5:
               x=5; y=7; chessType=bishop;
               break;
        case 6:
               x=6; y=7; chessType=knight;
               break;
        case 7:
               x=7; y=7; chessType=rook;
               break;
        case 8:
               x=0; y=6; chessType=pawn;
               break;
        case 9:
               x=1; y=6; chessType=pawn;
               break;
        case 10:
                x=2; y=6; chessType=pawn;
                break;
        case 11:
                x=3; y=6; chessType=pawn;
                break;
        case 12:
                x=4; y=6; chessType=pawn;
                break;
        case 13:
                x=5; y=6; chessType=pawn;
                break;
        case 14:
                x=6; y=6; chessType=pawn;
                break;
        case 15:
                x=7; y=6; chessType=pawn;
                break;
        case 16:
                x=0; y=0; chessType=rook;
                break;
        case 17:
                x=1; y=0; chessType=knight;
                break;
        case 18:
                x=2; y=0; chessType=bishop;
                break;
        case 19:
                x=3; y=0; chessType=queen;
                break;
        case 20:
                x=4; y=0; chessType=king;
                break;
        case 21:
                x=5; y=0; chessType=bishop;
                break;
        case 22:
                x=6; y=0; chessType=knight;
                break;
        case 23:
                x=7; y=0; chessType=rook;
                break;
        case 24:
                x=0; y=1; chessType=pawn;
                break;
        case 25:
                x=1; y=1; chessType=pawn;
                break;
        case 26:
                x=2; y=1; chessType=pawn;
                break;
        case 27:
                x=3; y=1; chessType=pawn;
                break;
        case 28:
                x=4; y=1; chessType=pawn;
                break;
        case 29:
                x=5; y=1; chessType=pawn;
                break;
        case 30:
                x=6; y=1; chessType=pawn;
                break;
        case 31:
                x=7; y=1; chessType=pawn;
                break;
    }

}

//get chess type
QString stone::getType()
{
    switch(chessType)
    {
        case pawn: return "pawn"; break;
        case rook: return "rook"; break;
        case knight: return "knight"; break;
        case bishop: return "bishop"; break;
        case queen: return "queen"; break;
        case king: return "king"; break;
    }
}
